DEF_PROJECT=../../..
include $(DEF_PROJECT)/scripts/main.mk
name=binutils
version=2.23
build=binutils-build
group=tools
deps=file mpc mpfr gmp ppl cloog-ppl linux-header
prefix=$(DIR_TOOLS)

DL_SERV=http
DL_HOST=ftp.gnu.org
DL_PATH=gnu/$(name)
DL_SUFFIX=tar.gz

CC_CFLAGS=-O2
CC_LDFLAGS=

cdefs+=AR=ar AS=as

cflags=--prefix=$(prefix)
cflags+=--build=$(CC_BUILD)
cflags+=--host=$(CC_HOST)
cflags+=--target=$(CC_TARGET)
cflags+=--with-sysroot=$(DIR_SYSROOT)
cflags+=--disable-nls
cflags+=--enable-shared
cflags+=--disable-multilib

#mflags+=configure-host all

pre-build:
	rm -rf $(build)
	mkdir -p $(build)
	cd $(build);$(cdefs) ../$</configure $(cflags)
	$(MAKE) -C$(if $(build),$(build),$(source)) configure-host

post-build:
	$(MAKE) -C$(if $(build),$(build),$(source)) $(iflags)
	cp $(source)/include/libiberty.h $(DIR_SYSROOT)/usr/include
